package sedev.shopping.business;

import sedev.shopping.data.PhamViDAO;
import sedev.shopping.entities.PhamVi;
import sedev.shopping.entities.ListPhamVi;
import sedev.shopping.util.Paging;

public class PhamViService {

	public static boolean addData(PhamVi data) {
		PhamViDAO dao = new PhamViDAO();
		return dao.addData(data);
	}

	public static boolean updateData(PhamVi data) {
		PhamViDAO dao = new PhamViDAO();
		return dao.updateData(data);
	}

	public static boolean removeData(int id) {
		PhamViDAO dao = new PhamViDAO();
		return dao.removeData(id);
	}

	public static PhamVi getData(int id) {
		PhamViDAO dao = new PhamViDAO();
		return dao.getData(id);
	}

	public static ListPhamVi getListDataByAll() {
		StringBuilder field = new StringBuilder();
		field.append(PhamVi.Properties.id.name());
		field.append(",").append(PhamVi.Properties.ten.name());

		StringBuilder condition = new StringBuilder();
		condition.append("1 AND 1");
		Paging paging = new Paging();
		
		PhamViDAO dao = new PhamViDAO();
		return dao.getListData(field.toString(), condition.toString(), "", paging);
	}
}
